<?php
switch($act)
{
    case "addcart":
        AddCart();
        break;
}

function AddCart()
{
    $id     = gpc_getIntPost('id');
    $listid = gpc_getSession('listid');
    if(!is_array($listid))
    {
        $listid = array();
    }
    $has=false;
    foreach($listid as $i=>$ll)
    {
        if($id==$ll[0])
        {
            $has=true;
        }
    }
    if($has==false)
    {
        $listid[]=array($id,1);
    }
    gpc_setSession('listid',$listid);
    
    AjaxTransfer('ok',array('count'=>count($listid),"msg"=>getLang('Added product to cart')));
}
?>